package com.bosssoft.g1.mapper;
import com.bosssoft.g1.dto.DepartmentDTO;
import com.bosssoft.g1.dto.UserDTO;
import com.bosssoft.g1.entity.User;
import com.bosssoft.g1.query.UserQuery;
import com.bosssoft.g1.vo.IdNameVO;
import com.bosssoft.g1.vo.RoleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.MySqlMapper;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author WangXin
 */
@Mapper
public interface UserMapper extends tk.mybatis.mapper.common.Mapper<User>, MySqlMapper<User> {

//    List<User> commonQuery(UserQuery userQuery);

    User findUserIsExist(String code, String password);

    int insertUser(User user);

    /**
     * 根据用户编号判断该用户是否已经存在
     * @param code
     * @return
     */
    Boolean userExistByUserCode(String code);

    int deleteByCode(String code);

    int deleteByUserExample(Example example);

    List<User> selectByName(String name);

    /**
     * 获取所有用户信息
     * @return 用户列表
     */
    List<UserDTO> getAllUsers();

    /*List<UserDTO> getAllUsers(Integer offset, Integer pageSize);*/

    List<UserDTO> searchUser(UserQuery userQuery);

    List<IdNameVO> getAllDepartments();

    List<IdNameVO> getAllRoles();

    List<IdNameVO> getAllPositions();

    List<UserDTO> queryUsers();

    List<UserDTO> getUsersByDepartmentId(Long id);

    List<UserDTO> getUsersByPositionId(Long id);

    List<UserDTO> getUsersByRoleId(Long id);
}